package com.dm.hdfxxt.cylmanage.controller;

import com.dm.hdfxxt.cylmanage.service.CylService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(value = "goCyl")
public class CylController {
    private static final Logger logger = LoggerFactory.getLogger(CylController.class);

    @Autowired
    private CylService cylService;

    /**
     * @Description 保存参与率项目信息
     * @Author zhangxue
     * @Date 18:29 2018/9/29
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/saveCyl",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveCyl(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap =  cylService.saveCyl(param);
        return ResultMap;
    }

    /**
     * @Description 编辑参与率项目信息
     * @Author zhangxue
     * @Date 18:29 2018/9/29
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/editCyl",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> editCyl(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap = cylService.editCyl(param);
        return ResultMap;
    }

    /**
     * @Description 删除参与率项目信息
     * @Author zhangxue
     * @Date 18:29 2018/9/29
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/delCyl",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> delCyl(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap = cylService.delCyl(param);
        return ResultMap;
    }

    /**
         * @Description  查询所有参与率项目
         * @Author zhangxue
         * @Date 11:35 2018/10/30
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/queryAllCyl",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> queryAllCyl(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap = new HashMap<>();
        List<Map<String,Object>> ResultList = cylService.queryAllCyl(param);
        ResultMap.put("ResultList",ResultList );
        return ResultMap;
    }

    /**
         * @Description 保存参与率项目业务数据
         * @Author zhangxue
         * @Date 11:30 2018/11/23
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/saveCylServiceInfo",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveCylServiceInfo(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap = cylService.saveCylServiceInfo(param);
        return ResultMap;
    }

    /**
         * @Description 添加参与总数
         * @Author zhangxue
         * @Date 14:54 2018/11/23
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/saveCylTotal",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveCylTotal(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap = cylService.saveCylTotal(param);
        return ResultMap;
    }

    /**
     * @Description  根据条件计算参与率
     * @Author zhangxue
     * @Date 11:35 2018/10/30
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/queryCylCaculate",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> queryCylCaculate(@RequestBody Map<String,Object> param){
        Map<String,Object> ResultMap = cylService.queryCylCaculate(param);
        return ResultMap;
    }
}
